<?php
class Supplier {

    public static function getList($where=null, $s=0, $l=0){
		return Db::get(__CLASS__)->select('*')->where($where)->order('id ASC')
									->hkey('id')->limit($s,$l)->getAll();
	}

	public static function count($where){
		return Db::get(__CLASS__)->count()->where($where)->getCol();
	}

	static function getFullName($id){
		return Db::get(__CLASS__)->select('full_name')->where(array('id'=>$id))->getCol();
	}

	static function add($data){
		return Db::get(__CLASS__)->insert($data)->exec() ? Db::get(__CLASS__)->insertId() : false;
	}
	
	static function modify($id, $data){
		return Db::get(__CLASS__)->update($data)->where(array('id'=>$id))->exec();
	}
	
	static function get($id){
		return Db::get(__CLASS__)->select()->where(array('id'=>$id))->getOne();
	}
	static function delete($id){
		return Db::get(__CLASS__)->delete()->where(array('id'=>$id))->exec();
	}
	
}
?>
